package org.nepu.srr.设备设施资料.固井设备及管线证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;

@Data
public class B46FixWellParams {
    @ApiModelProperty("固井泵总成")
    CommonIn pumpTotal;

    @ApiModelProperty("固井管汇及阀门")
    CommonIn pipelineValveAndValve;

    @ApiModelProperty("固井高压软管")
    CommonIn highPressureSoftPipe;

    @ApiModelProperty("自动混浆装置")
    CommonIn autoMixingDevice;

    @ApiModelProperty("下灰系统")
    CommonIn drainageSystem;

    @ApiModelProperty("水柜及计量仪表")
    CommonIn waterTankAndMeter;

    @ApiModelProperty("其他有关仪器仪表")
    CommonIn otherInstrumentsAndMeters;

    public B46FixWellResult rate(){
        double fullScore = 60;
        double score = 0;
        if(CommonMethods.isAllTrue(pumpTotal.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(pipelineValveAndValve.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(highPressureSoftPipe.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(autoMixingDevice.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(drainageSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(waterTankAndMeter.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(otherInstrumentsAndMeters.getInput())){
            score += 10;
        }
        double rate = score / fullScore;
        B46FixWellResult result = new B46FixWellResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
